/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package pt.iscte.iul.dcti.pa.gspas.model;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import pt.iscte.iul.dcti.pa.gspas.gui.annotation.ArgsNameAnnotation;
import pt.iscte.iul.dcti.pa.gspas.gui.annotation.ComponentLabelAnnotation;
import pt.iscte.iul.dcti.pa.gspas.gui.annotation.ModelAnnotation;

/**
 *
 * @author Gedsimon Pereira - 58554
 * @contact gspas@iscte.pt
 */
public class Course {
    
    private String name;
    private List<Student> students;
    private Set<Assignment> assignments;

    public Course() {
    }
    
    @ComponentLabelAnnotation(label = "Name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Student> getStudents() {
        return students;
    }

    public void setStudents(List<Student> students) {
        this.students = students;
    }

    public Set<Assignment> getAssignments() {
        return assignments;
    }

    public void setAssignments(Set<Assignment> assignments) {
        this.assignments = assignments;
    }
    
    @ModelAnnotation(clazz = Student.class)
    @ArgsNameAnnotation(argsName = {"Number", "Name"})
    public void addStudent(int number, String name){
        if(students == null){
        	students = new ArrayList<Student>();
        }
        students.add((new Student(name, number)));
    }
    
    @ModelAnnotation(clazz = Assignment.class)
    @ArgsNameAnnotation(argsName = {"Name"})
    public void addAssignment(String name){
        if(assignments == null){
        	assignments = new HashSet<Assignment>();
        }
        assignments.add(new Assignment(name));
    }
}
